//
//  WLView+.swift
//  HengYouCai
//
//  Created by wll on 2017/11/14.
//  Copyright © 2017年 lwj. All rights reserved.
//  UIView+

import Foundation

extension UIView {
    
    ///切单方位的圆角 转入方位：[.topLeft, .topRight]  圆角度：20.0
    func wl_clipCorner(_ corner: UIRectCorner, _ radio: CGFloat) {
        let  tLayer = CAShapeLayer() 
        tLayer.frame = self.bounds
        //MARK:这个地方要么给clear 要么不给  否则会被渲染成view的背景色,导致圆角不显示
//        tLayer.backgroundColor = UIColor.clear.cgColor
        tLayer.path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corner, cornerRadii: CGSize(width: radio, height: radio)).cgPath
        self.layer.mask = tLayer
    }
  
}

